package com.eugene.mathUtil;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.eugene.interfaces.Calculable;

public class StatsUtil {
	private final static Logger logger = LoggerFactory.getLogger(StatsUtil.class);	
	
	public static <T extends Calculable> double calculateAverage(List<T> list){
		double rst =0.0;
		if(list.size() ==0 ){
			logger.error("Size of list for calcuate averateg is zero");
			System.exit(-99);
		}
		for(T aa:list){
			rst = rst + aa.getValue();
		}
		return rst / list.size();
	}
	
	public static <T extends Calculable> void calculateAverage(List<T> list, T rst){
		
	}
	
	
	
	public static <T extends Calculable> void calculateVariance(List<T> list, T rst){
		
	}
	
	
}
